<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="../assets/js/vue.js"></script>
    <link rel="stylesheet" href="../assets/css/index.css"/>
</head>
<body>
<h1>v-bind</h1>
<hr>
<div id="app">
    <img v-bind:src="src" :width="width"/>
    <hr>
    <div :class="className">1.绑定class</div>
    <div :class="{classA:colorOr}">2.绑定class中的判断</div>
    <div :class="[classA,classB]">3.绑定class中使用数组</div>
    <div :class="[colorOr?classA:classB]">4.绑定class中使用三元表达式,必须在数组模式中用</div>
    <div :class="[{classA:colorOr},classB]">5.绑定class中使用判断组合</div>
    <hr>
    <div :style="{color:red,fontSize:font}">6.style绑定</div>
    <div :style="fontArray">7.style绑定json语句</div>
</div>
<style>
    .classA {
        color: red;
    }

    .classB {
        font-size: 200%;
    }
</style>

<script>
    var app = new Vue({
        el: '#app',
        data: {
            message: 'hello Vue',
            src: 'http://bbs.enorth.com.cn/data/attachment/common/b5/common_55_icon.png',
            width: 100,
            className: 'classA',
            colorOr: false,
            classA: 'classA',
            classB: 'classB',
            red:'red',
            font:'30px',
            fontArray:{
                color:'green',
                fontSize:'12px'
            }
        }
    })
</script>
</body>
</html>